package com.zhejiangzhengyuan.municipal_common.mapper;

import com.zhejiangzhengyuan.municipal_common.entity.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhejiangzhengyuan.municipal_common.entity.vo.JurisdictionVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author linju
 * @since 2019-11-22
 */
@Repository
public interface PermissionMapper extends BaseMapper<Permission> {

    List<Permission> findBySubjectId(@Param("id") Long id);


    @Select("select a.* from action a ,permission p,permission_action_mapping pam\n" +
            "            where a.id=pam.action_id and p.id=pam.permission_id and p.id=#{pid}")
    List<JurisdictionVo> selectPermissionByAction(@Param("pid") Long id);
}
